<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/ui-base.css">
<link rel="stylesheet" href="css/ui-box.css">
<link rel="stylesheet" href="css/project/style.css">
<link rel="stylesheet" href="css/zv_common.css">
 <script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zy_json.js"></script>
<script src="js/main.js"></script>
<script src="js/init.js"></script>
<script type="text/javascript" src="js/JsonSQL/jsonsql-0.1.js"></script>
<script src="js/talkingdata.js"></script>
<style type="text/css">
        .notecon{ background:url(images/notecon.png) no-repeat; margin-top:0.2em; background-size:68%; }
        </style>
</head>
<body class="um-vp c-wh2" ontouchstart>
<div id="page_1" class="ub ub-ver um-vp">
<div class="ub ub-ver">
	<div id="attendance_list"></div>
	<div id="rowindex"></div>
</div>
</div>	 
<div id="LoadMore">
</div>
</body>
<script>
zy_init();
function LoadMore(content_page)
{
	IC.talkingDataCount("考勤管理","0018");
		$$("LoadMore").innerHTML = '<div style="height:2.6em;  line-height:2.6em;background:#e8e8e8; text-align:center; font-size:0.9em; color:#4d4d4d; overflow:hidden; display:block; border-top:solid #ffffff 1px">加载中...</div> ';
	var page = localStorage.getItem("attendance_management_page");
	var nextpage = parseInt(page)+1;
	ueppscript("attendance_management_search","content","LoadDataS("+nextpage+","+content_page+")");
	//uescript("attendance_management","");
}
window.uexOnload=function(type){
	//$("body").css("opacity","0");
	if(!type){
		uexWindow.setBounce("0");
		IC.talkingDataCount("考勤管理","0018");
	}
	attendance_list()
}
Loading(0);

function getOldData()
{
	IC.talkingDataCount("考勤管理","0018");
	var oldData = $$("attendance_list").innerHTML;
	
	localStorage.setItem("oldData",oldData);
}
function attendance_list(){	
			 var strx = "";
			 var json = localStorage.getItem("zvData");
			 var jsona ='['+json+']';
			 var  obj = strToJson(jsona);
			 var  TotalCount=obj[0].Result.TotalCount
			 localStorage.setItem("TotalCount",TotalCount);
			 var objdata = obj[0].Result.DataTable;
			 var enl=objdata.length
			if(enl==undefined || enl=="undefined")
			{
				var stringObj=json  
				var zv_newstr=stringObj.replace('"DataTable":{"Rows":{','"DataTable":[{'); //字符替换 
				zv_newstr=zv_newstr.replace('}}}}','}]}}'); //字符替换 
				zv_newstr ='['+zv_newstr+']';
				zv_objdata = strToJson(zv_newstr);
				objdata = zv_objdata[0].Result.DataTable;
			}
			var z=0
			for(var i=0;i<objdata.length;i++)
			{
				
				var startpage=''
				var endpage=''
				var beforepage=''
				var afterpage=''
				var orderx=(parseInt(z)+1)%4;
				if(parseInt(orderx)==0)
				{
					orderx= 4;
				}
				z++
				
				
				
				var ActualWorkingHours=objdata[i].ActualWorkingHours
				if(ActualWorkingHours=="" || ActualWorkingHours=="0" || ActualWorkingHours=="undefined" ||   ActualWorkingHours==undefined)
				{
					ActualWorkingHours=0
				}
				else
				{
					ActualWorkingHours=parseFloat(ActualWorkingHours).toFixed(1)
				}
				strx += '<div class="ub ub-ver zv_lbg'+orderx+'"  onclick="LoadDetail(\''+objdata[i].employeeNumber+'\',\''+objdata[i].rowindex+'\')">'
    			strx += '<div class="ub c-fff ubt b-gra5 umh2 ub-ac scheresline">'
                strx += '<div class="ulev0 ub-f1 uinn zv_h1">'+objdata[i].EmployeeName+'('+objdata[i].employeeNumber+')</div>'//&nbsp;&nbsp;'+objdata[i].roleName+'
                strx += '<div class="umw2 ub">'
	            strx += '<div class="uwh-tBtn ub-img"><input type="hidden" id="member'+objdata[i].rowindex+'" value="'+objdata[i].employeeNumber+'" /></div>'
	           	strx += '</div>'
         		strx += '</div>'
         	    strx += '<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" style="font-size:0.8125em;">'
          		strx += '<tr class="zv_h1">'
            	strx += '<td width="40%" style="margin-left:0.5em; height:2.1em; line-height:2.1em">&nbsp;计划工作：'+objdata[i].WorkDays+'天&nbsp;</td>'
            	strx += '<td width="37%">计划工作：'+objdata[i].WorkingHours+'H</td>'
            	strx += '<td width="22%" rowspan="2" style="line-height:1.4em">迟到：'+objdata[i].LateDays+'次</br>早退：'+objdata[i].LeaveEarlyDays+'次</br>矿工：'+objdata[i].AbsentDays+'次</td>'
          		strx += '</tr>'
          		strx += ''
				strx += '<tr class="zv_h1"><td width="40%" style="margin-left:0.5em;height:2.1em; line-height:2.1em">&nbsp;实际工作：'+objdata[i].ActualWorkDays+'天</td><td width="37%">实际工作：'+ActualWorkingHours+'H</td>'
            	strx += ''
         		strx += '</tr>'
      			strx += '</table>'
    			strx += '</div>'
			}
			$$("attendance_list").innerHTML= $$("attendance_list").innerHTML+strx;
			var s= objdata.length-1
			if(s<0)
			{
				s=''	
			}
			else
			{
			s=parseInt(objdata[s].rowindex)+1
			}
			$$("rowindex").innerHTML='<input type="hidden" id="member'+s+'" value="" />'
			var load_more=''
			if(s<TotalCount)
			{
				load_more='<div style="height:2.6em;  line-height:2.6em;background:#e8e8e8; text-align:center; font-size:0.9em; color:#4d4d4d; overflow:hidden; display:block; border-top:solid #ffffff 1px" onclick="LoadMore()">加载更多</div>'
			}
			$$("LoadMore").innerHTML =load_more;
			Loading(-1);
			
			var content_page= localStorage.getItem("content_page");
			var member_page= localStorage.getItem("member_page");
			member_page=parseInt(member_page)+1
			if(content_page==member_page && content_page!='null'&& content_page!=null)
			{
				LoadDetail(1,member_page,1)
			}
			localStorage.setItem("content_page",'');
			
	var SiteName=localStorage.getItem("SiteName");//站点名称
	var SiteID=localStorage.getItem("SiteID");//附属站点
	var PeriodStart=localStorage.getItem("PeriodStart");//开始日期
	var PeriodEnd=localStorage.getItem("PeriodEnd");//结束日期
}
function LoadDetail(attendance_id,page,type){
	IC.talkingDataCount("考勤管理","0018");
	if(attendance_id=='')
	{
		LoadMore(page)
	}
	if(attendance_id=='1')
	{
		attendance_id = $$("member"+page).value; /*上员工号*/	
	}
	var startpage=parseInt(page)-1
	var endpage=parseInt(page) +1
	var startmember_id='0'
	if(startpage>=1)
	{
		startmember_id = $$("member"+startpage).value; /*上员工号*/	
	}
	endmember_id = $$("member"+endpage).value; /*下员工号*/
	localStorage.setItem("startmember_id",startmember_id);
	localStorage.setItem("endmember_id",endmember_id);
	localStorage.setItem("member_page",page);
	var SiteName=localStorage.getItem("SiteName");//站点名称
	var SiteID=localStorage.getItem("SiteID");//附属站点
	var PeriodStart=localStorage.getItem("PeriodStart");//开始日期
	var PeriodEnd=localStorage.getItem("PeriodEnd");//结束日期
	var wsdl = attendance_management_conetnt_url
	var nameSpace = attendance_management_conetnt_nameSpace 
	var paras = "CenterName|EmployeeNumber|PeriodStart|PeriodEnd|SiteID|PageCount|CurrentPage";
	var values = SiteName+'|'+attendance_id+'|'+PeriodStart+'|'+PeriodEnd+'|'+SiteID+'|1000|1';
	var method =attendance_management_conetnt_function
	if(type==1)
	{
		attendanceJosn(wsdl,nameSpace,paras,values,method);	
	}
	else
	{
		setLocalJosn(wsdl,nameSpace,paras,values,method,"attendance_working_hours","attendance_working_hours.html");	
	}
}
function attendanceJosn(wsdl,nameSpace,paras,values,method){
		IC.talkingDataCount("考勤管理","0018");
		uexEMM.setEvent("1","{'考勤管理':'考勤管理详细'}");
		var jsonPage =[{'key':'wsdl','type':'0','value':wsdl},{'key':'KEY1','type':'0','value':'1'},
 {'key':'KEY2','type':'0','value':'1'}, {'key':'KEY3','type':'0','value':'1'}, {'key':'nameSpace','type':'0','value':nameSpace}, {'key':'method','type':'0','value':method}, {'key':'paras','type':'0','value':paras}, {'key':'values','type':'0','value':values}];
	var SOAPTypeA = "yes";
	$.getJSON(UrlClient+"&SOAPType="+SOAPTypeA,function(json){
                        var jsonStr = JSON.stringify(json);
						localStorage.setItem("zvData",jsonStr);
							document.getElementById("zvmain").style.display="none";
							document.getElementById("Loadbox").style.display="none";
							ueppscript("attendance_working_hours","content","attendance_list()");
            },"json",function(e){},"POST",jsonPage,false);
	
}	
</script>
</html>
